package j02class;

import java.util.Random;

//主类，类名和文件名一致
//定义一个类，就定义了一个数据类型(引用数据类型)
class Cat {
    int age;
    int height;
    String name;
    int legs = 4;

    //没有static
    public void say(){
        System.out.println("i am 波斯 cat");
    }
    public void run(){
        System.out.println("i can run fast!");
    }



    public static void f1() {

    }
}

//不是主类不能加public
//public class Dog{}

class CatTest{
    public static void main(String[] args) {

        //int 0   bolean false   0.0  String null
        Cat cat1 = new Cat();
        System.out.println("cat1 = " + cat1);//16进制地址

        Cat cat2 = new Cat();
        System.out.println("cat2 = " + cat2);
        System.out.println("cat2.name = " + cat2.name);
        cat2.name="小凳子";
        System.out.println("cat2.name = " + cat2.name);

        System.out.println("cat2.age = " + cat2.age);//0
        cat2.age = 2;
        System.out.println("cat2.age = " + cat2.age);//2

//        cat2.age = "2";

        int nianling = cat2.age;
        System.out.println("nianling = " + nianling);//2

    }
}

class Class2{
    public static void main(String[] args) {
        Random r = new Random();
    }
}
